/*    */ package com.chw.admin.sysparam;
/*    */ 
/*    */ import com.github.pagehelper.PageHelper;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ 
/*    */ @Service
/*    */ public class SysParamsService
/*    */   implements ISysParamsService
/*    */ {
/*    */ 
/*    */   @Autowired
/*    */   private SysParamsMapper sysParamsMapper;
/*    */ 
/*    */   public List selectByCode(String typeCode)
/*    */   {
/* 19 */     List list = this.sysParamsMapper.selectByCode(typeCode);
/* 20 */     List l = new ArrayList();
/* 21 */     if (list.size() > 0) {
/* 22 */       for (int i = 0; i < list.size(); i++) {
/* 23 */         SysParam s = new SysParam();
/* 24 */         s.setId(((SysParams)list.get(i)).getParamKey());
/* 25 */         s.setText(((SysParams)list.get(i)).getParamValue());
/* 26 */         l.add(s);
/*    */       }
/*    */     }
/* 29 */     return l;
/*    */   }
/*    */ 
/*    */   public PageInfo selectByCodes(SysParams sysParams, Integer currentPage, Integer pageSize)
/*    */   {
/* 34 */     PageHelper.startPage(currentPage.intValue(), pageSize.intValue());
/* 35 */     if ((sysParams.getParamLevel() == null) || ("0".equals(sysParams.getParamLevel()))) {
/* 36 */       sysParams.setParamLevel("1");
/*    */     } else {
/* 38 */       int l = Integer.parseInt(sysParams.getParamLevel());
/* 39 */       int ll = l + 1;
/* 40 */       sysParams.setParamLevel(String.valueOf(ll));
/* 41 */       sysParams.setTypeCode(sysParams.getParamKey());
/*    */     }
/* 43 */     List list = this.sysParamsMapper.findNextMap(sysParams);
/* 44 */     return new PageInfo(list);
/*    */   }
/*    */ 
/*    */   public SysParams selectByKey(String key)
/*    */   {
/* 49 */     return this.sysParamsMapper.selectByKey(key);
/*    */   }
/*    */ 
/*    */   public PageInfo pageParams(SysParams sysParams, Integer currentPage, Integer pageSize)
/*    */   {
/* 55 */     PageHelper.startPage(currentPage.intValue(), pageSize.intValue());
/* 56 */     List list = this.sysParamsMapper.findMap(sysParams);
/* 57 */     return new PageInfo(list);
/*    */   }
/*    */ 
/*    */   public SysParams selectById(String id) {
/* 61 */     return this.sysParamsMapper.selectById(id);
/*    */   }
/*    */ 
/*    */   public int updateSysParams(SysParams sysParams)
/*    */   {
/* 66 */     return this.sysParamsMapper.updateByIdSelective(sysParams);
/*    */   }
/*    */ 
/*    */   public int deleteById(String id)
/*    */   {
/* 71 */     return this.sysParamsMapper.deleteById(id);
/*    */   }
/*    */ 
/*    */   public int addSysParams(SysParams sysParams)
/*    */   {
/* 76 */     return this.sysParamsMapper.insert(sysParams);
/*    */   }
/*    */ }

/* Location:           E:\chenya\haha\admin java\sysparam\
 * Qualified Name:     com.chw.admin.sysparam.SysParamsService
 * JD-Core Version:    0.6.0
 */